import { getSetting, chooseAddress, openSetting, showModal, showToast, requestPayment ,login} from "../../utils/asyncWx.js";
import regeneratorRuntime from '../../lib/runtime/runtime';
import { request } from "../../request/index.js";
Page({
  async  handleGetUserInfo(e){
    try {
        //获取请求token的必要参数
        const {encryptedData,iv,rawData,signature} = e.detail
         const {code} = await login();
         const loginParams ={encryptedData,iv,rawData,signature,code}
          // 发送请求获取token(无企业微信 token为null 使用虚假的token)
        //  const rew = await request({url:"/user/wxlogin",data:loginParams,method:"post"}),
        const token = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo"
        //将token储存到缓存
        wx.setStorageSync('token', 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo');
        wx.navigateBack({
          delta: 1
        })
      
    } catch (error) {
      console.log(error)
     }    
      
    }
  

})